package weibo4j.model;

import weibo4j.org.json.JSONException;
import weibo4j.org.json.JSONObject;

public class Place {


	private String poiid;
	private String title;
	private double longitude;
	private double latitude;
	private String type;
	
	public Place(JSONObject json) throws JSONException {
			this.poiid = json.getString("poiid");
			this.title = json.getString("title");
			this.longitude = json.getDouble("lon");
			this.latitude = json.getDouble("lat");			
			this.type = json.getString("type");
	}
	
	public String getPoi() {
		return poiid;
	}
	public void setPoi(String poiid) {
		this.poiid = poiid;
	}
	
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	
	public double getLongitude() {
		return longitude;
	}
	public void setLongitude(double lon) {
		this.longitude = lon;
	}
	
	public double getLatitude() {
		return latitude;
	}
	public void setLatitude(double lat) {
		this.latitude = lat;
	}
	
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + ((poiid == null) ? 0 : poiid.hashCode());
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Place other = (Place) obj;
		if (poiid != other.poiid)
			return false;
		if (type != other.type)
			return false;
		if (title != other.title)
			return false;
		if (longitude != other.longitude)
			return false;
		if (latitude != other.latitude)
			return false;
		return true;
	}
	@Override
	public String toString() {
		return "Place [poiid=" + poiid + 
				", title=" + title + 
				", type=" + type + 
				", longitude="+ longitude + 
				", latitude="+latitude+"]";
	}
	
	
	
	
	
}
